﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ManageProduct.aspx.cs" Inherits="Manageweb_ManageProduct_ManageProduct" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>无标题页</title>
    
<link href="../images/css.css" rel="stylesheet" type="text/css" />
    
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <table width="750" border="1" cellspacing="0" cellpadding="0">
          <tr>
            <td style="background-color:#507cd1; color:White; font-weight:bold; text-align:left;">
                &nbsp;管理产品&nbsp;</td>
          </tr>
        </table>
        <br />
        <table width="750" border="1" cellspacing="0" cellpadding="3">
          <tr>
              <td colspan="2" style="background-color:#507cd1; color:White; font-weight:bold; text-align:left;">
                  &nbsp;管理选项 （注：序号大的排序在前）</td>
          </tr>
          <tr>
            <td style="width:50%; text-align: left;">&nbsp;<asp:TextBox ID="TB_Search" runat="server" Width="240px"></asp:TextBox>
                <asp:Button ID="Btn_Search" runat="server" Text="搜索" ValidationGroup="Btn_Search" OnClick="Btn_Search_Click" />
                <asp:RequiredFieldValidator ID="RFV_TB_Search" runat="server" ControlToValidate="TB_Search"
                    Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_Search"></asp:RequiredFieldValidator></td>
            <td style="text-align: left">&nbsp;<asp:DropDownList ID="DDL_Class" runat="server" Width="240px">
                </asp:DropDownList>
                <asp:Button ID="Btn_AddProduct" runat="server" Text="添加产品" ValidationGroup="Btn_AddProduct" OnClick="Btn_AddNews_Click" />
                <asp:RequiredFieldValidator ID="RFV_DDL_Class" runat="server" ControlToValidate="DDL_Class"
                    Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_AddProduct"></asp:RequiredFieldValidator></td>
          </tr>
          <tr>
              <td colspan="2" style="text-align: left">
                  &nbsp;产品一：<asp:UpdatePanel ID="UpdatePanel1" runat="server" RenderMode="Inline">
                      <ContentTemplate>
                          <asp:DropDownList ID="DDL_Class1" runat="server" AppendDataBoundItems="True" AutoPostBack="True" DataSourceID="ODS_Class1" DataTextField="PC_Title" DataValueField="PC_ClassCode" Width="100px" OnSelectedIndexChanged="DDL_Class1_SelectedIndexChanged">
                      <asp:ListItem></asp:ListItem>
                  </asp:DropDownList>
                          <asp:RequiredFieldValidator ID="RFV_DDL_Class1" runat="server" ControlToValidate="DDL_Class1"
                              Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_ConvertIndex"></asp:RequiredFieldValidator>
                  <asp:DropDownList ID="DDL_Product1" runat="server" AppendDataBoundItems="True" DataSourceID="ODS_Product1" DataTextField="Product_Title" DataValueField="Product_ID" Width="100px" AutoPostBack="True" OnSelectedIndexChanged="DDL_Product1_SelectedIndexChanged">
                      <asp:ListItem></asp:ListItem>
                  </asp:DropDownList>
                          <asp:RequiredFieldValidator ID="RFV_DDL_Product1" runat="server" ControlToValidate="DDL_Product1"
                              Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_ConvertIndex"></asp:RequiredFieldValidator>
                          序号：<asp:Label ID="LB_Product1Index" runat="server"></asp:Label>
                      </ContentTemplate>
                  </asp:UpdatePanel>
                  &nbsp; |&nbsp; 产品二：<asp:UpdatePanel ID="UpdatePanel2" runat="server" RenderMode="Inline">
                      <ContentTemplate>
                          <asp:DropDownList ID="DDL_Class2" runat="server" Width="100px" AutoPostBack="True" DataSourceID="ODS_Class2" DataTextField="PC_Title" DataValueField="PC_ClassCode" AppendDataBoundItems="True" OnSelectedIndexChanged="DDL_Class2_SelectedIndexChanged">
                              <asp:ListItem></asp:ListItem>
                  </asp:DropDownList>
                          <asp:RequiredFieldValidator ID="RFV_DDL_Class2" runat="server" ControlToValidate="DDL_Class2"
                              Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_ConvertIndex"></asp:RequiredFieldValidator>
                          <asp:DropDownList ID="DDL_Product2" runat="server" Width="100px" AppendDataBoundItems="True" AutoPostBack="True" DataSourceID="ODS_Product2" DataTextField="Product_Title" DataValueField="Product_ID" OnSelectedIndexChanged="DDL_Product2_SelectedIndexChanged">
                              <asp:ListItem></asp:ListItem>
                  </asp:DropDownList>
                          <asp:RequiredFieldValidator ID="RFV_DDL_Product2" runat="server" ControlToValidate="DDL_Product2"
                              Display="Dynamic" ErrorMessage="*" ValidationGroup="Btn_ConvertIndex"></asp:RequiredFieldValidator>
                          序号：<asp:Label ID="LB_Product2Index" runat="server"></asp:Label>
                      </ContentTemplate>
                  </asp:UpdatePanel>
                          &nbsp; |&nbsp;
                  <asp:Button ID="Btn_ConvertIndex" runat="server" Text="交换顺序" OnClick="Btn_ConvertIndex_Click" ValidationGroup="Btn_ConvertIndex" />
              </td>
          </tr>
          <tr>
              <td colspan="2" style="text-align: left">
                  批量操作：&nbsp;<asp:Button ID="Btn_Multi_Index" runat="server" Text="批量推荐" CommandName="Multi_Index" OnCommand="Btn_Multi_Command" />
                  |
                  <asp:Button ID="Btn_Multi_Non_Index" runat="server" Text="取消推荐" CommandName="Multi_Non_Index" OnCommand="Btn_Multi_Command" />
                  |&nbsp;<asp:Button ID="Btn_Multi_Lock" runat="server" Text="批量锁定" CommandName="Multi_Lock" OnCommand="Btn_Multi_Command" />
                  |
                  <asp:Button ID="Btn_Multi_Non_Lock" runat="server" Text="取消锁定" CommandName="Multi_Non_Lock" OnCommand="Btn_Multi_Command" />
                  |
                  <asp:Button ID="Btn_Multi_Del" runat="server" Text="批量删除" CommandName="Multi_Del" OnCommand="Btn_Multi_Command" />
                  |
                  <asp:Button ID="Btn_Multi_RealDel" runat="server" Text="永久删除" OnClick="Btn_Multi_RealDel_Click" />&nbsp;</td>
          </tr>
        </table>
            <asp:ObjectDataSource ID="ODS_Class1" runat="server" OldValuesParameterFormatString="original_{0}"
                SelectMethod="GetDataOrderByClassCode" TypeName="AccessDAL.ProductClassTableAdapters.ProductClassTableAdapter">
                <SelectParameters>
                    <asp:Parameter DefaultValue="false" Name="PC_IsLock" Type="Boolean" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="ODS_Product1" runat="server" OldValuesParameterFormatString="original_{0}"
                SelectMethod="GetDataByClassOrderByDataTime" TypeName="AccessDAL.ProductTableAdapters.PC_PTableAdapter">
                <SelectParameters>
                    <asp:ControlParameter ControlID="DDL_Class1" DefaultValue="" Name="Product_ClassCode"
                        PropertyName="SelectedValue" Type="String" />
                    <asp:Parameter DefaultValue="false" Name="Product_IsDel" Type="Boolean" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="ODS_Class2" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataOrderByClassCode" TypeName="AccessDAL.ProductClassTableAdapters.ProductClassTableAdapter">
                <SelectParameters>
                    <asp:Parameter DefaultValue="false" Name="PC_IsLock" Type="Boolean" />
                </SelectParameters>
            </asp:ObjectDataSource>
            <asp:ObjectDataSource ID="ODS_Product2" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByClassOrderByDataTime" TypeName="AccessDAL.ProductTableAdapters.PC_PTableAdapter">
                <SelectParameters>
                    <asp:ControlParameter ControlID="DDL_Class2" Name="Product_ClassCode" PropertyName="SelectedValue"
                        Type="String" />
                    <asp:Parameter DefaultValue="false" Name="Product_IsDel" Type="Boolean" />
                </SelectParameters>
            </asp:ObjectDataSource>
        <br />
        <asp:Label ID="LB_ManageProduct" runat="server" Font-Bold="True" Font-Size="Small" ForeColor="Red"></asp:Label>
            <table border="1" cellpadding="0" cellspacing="0" width="750">
                <tr>
                    <td>
                        <asp:GridView ID="GV_ProductList" runat="server" CellPadding="4" ForeColor="#333333"
                            Width="100%" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataSourceID="ODS_ProductList" PageSize="15" DataKeyNames="Product_ID">
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <RowStyle BackColor="#EFF3FB" />
                            <EditRowStyle BackColor="#2461BF" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                            <Columns>
                                <asp:BoundField DataField="Product_ID" HeaderText="Product_ID" InsertVisible="False"
                                    SortExpression="Product_ID" Visible="False" />
                                <asp:TemplateField HeaderText="名称" SortExpression="Product_Title">
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("Product_Title") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="PC_Title" HeaderText="类别" SortExpression="PC_Title" />
                                <asp:TemplateField HeaderText="图片" SortExpression="Product_SmallThumb">
                                    <ItemTemplate>
                                        <asp:Image ID="Image1" runat="server" Height="60px" ImageUrl='<%# FormatThumb(Eval("Product_SmallThumb")) %>'
                                            Width="80px" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="首页推荐">
                                    <ItemTemplate>
                                        <asp:Button ID="Btn_Index" runat="server" CommandArgument='<%# Eval("Product_ID") %>'
                                            OnCommand="Btn_Index_Command" Text='<%# FormatIndex(Eval("Product_Index")) %>'
                                            Width="55px" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:CheckBoxField DataField="Product_IsLock" HeaderText="锁定" SortExpression="Product_IsLock" />
                                <asp:BoundField DataField="Product_Order" HeaderText="排序" SortExpression="Product_Order" />
                                <asp:TemplateField HeaderText="选择">
                                    <ItemTemplate>
                                        <asp:CheckBox ID="CB_Check" runat="server" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:LinkButton ID="LBtn_Mod" runat="server" CommandArgument='<%# Eval("Product_ID") %>' OnCommand="LBtn_Mod_Command">修改</asp:LinkButton>
                                        <asp:LinkButton ID="LBtn_Del" runat="server" CommandArgument='<%# Eval("Product_ID") %>' OnCommand="LBtn_Del_Command" OnClientClick="return confirm('确认删除此项目？')" Text='删除'></asp:LinkButton>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:BoundField DataField="Product_DateTime" HeaderText="创建时间" SortExpression="Product_DateTime" />
                            </Columns>
                        </asp:GridView>
                        <asp:ObjectDataSource ID="ODS_ProductList" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataOrderByDataTime" TypeName="AccessDAL.ProductTableAdapters.PC_PTableAdapter">
                            <SelectParameters>
                                <asp:Parameter DefaultValue="false" Name="Product_IsDel" Type="Boolean" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                        <asp:ObjectDataSource ID="ODS_ProductList2" runat="server" OldValuesParameterFormatString="original_{0}"
                            SelectMethod="GetDataByClassOrderByDataTime" TypeName="AccessDAL.ProductTableAdapters.PC_PTableAdapter">
                            <SelectParameters>
                                <asp:SessionParameter Name="Product_ClassCode" SessionField="ProductClassCode" Type="String" />
                                <asp:Parameter DefaultValue="false" Name="Product_IsDel" Type="Boolean" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                        <asp:ObjectDataSource ID="ODS_Search" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByLikeTitle" TypeName="AccessDAL.ProductTableAdapters.PC_PTableAdapter">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="TB_Search" Name="Product_Title" PropertyName="Text"
                                    Type="String" />
                                <asp:Parameter DefaultValue="false" Name="Product_IsDel" Type="Boolean" />
                            </SelectParameters>
                        </asp:ObjectDataSource>
                    </td>
                </tr>
            </table>
    </div>
    </form>
</body>
</html>
